//
//  OtherSettingCell.m
//  CoachsBook
//
//  Created by huiyong li on 2022/8/31.
//

#import "OtherSettingCell.h"
@interface OtherSettingCell()
@property(nonatomic,strong) UIImageView *iconImage;
@property(nonatomic,strong) UIImageView *arrowImage;
@property(nonatomic,strong) UILabel *titleLabel;
@property(nonatomic,strong) UILabel *contentLabel;
@property(nonatomic,strong) UIView *lineView;

@end
@implementation OtherSettingCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

{
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
        self.contentView.backgroundColor = rgba(255, 255, 255, 1);
    }
    return self;
}

- (void)setupUI
{
    self.iconImage = [[UIImageView alloc]initWithFrame:CGRectMake(16, 10, 30, 30)];
    self.iconImage.backgroundColor = rgba(245, 245, 250, 1);
    self.iconImage.layer.cornerRadius = 15;
    self.iconImage.layer.masksToBounds = YES;
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImage.frame)+8, 10, 120, 30)];
    self.titleLabel.font = kPingFangRegular(14);
    self.titleLabel.textColor = rgba(51, 51, 51, 1);
    
    self.contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.titleLabel.frame)+8, 10, APPwidth-CGRectGetMaxX(self.titleLabel.frame)-82, 30)];
    self.contentLabel.font = kPingFangRegular(12);
    self.contentLabel.textColor = rgba(153, 153, 153, 1);
    self.contentLabel.textAlignment = NSTextAlignmentRight;
    
    
    self.cellcopyBut = [[UIButton alloc]initWithFrame:CGRectMake(APPwidth - 66, 12, 50, 26)];
    self.cellcopyBut.layer.cornerRadius = 13;
    self.cellcopyBut.layer.masksToBounds = YES;
    self.cellcopyBut.backgroundColor = rgba(22, 120, 255, 1);
    [self.cellcopyBut setTitle:@"复制" forState:UIControlStateNormal];
    [self.cellcopyBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.cellcopyBut.titleLabel.font = kPingFangRegular(14);
    self.cellcopyBut.hidden = YES;
    
    self.arrowImage = [[UIImageView alloc]initWithFrame:CGRectMake(APPwidth-32, 17, 16, 16)];
    self.arrowImage.image = [UIImage imageNamed:@"mine_arrow"];
    self.arrowImage.hidden = YES;
    
    [self.contentView addSubview:self.iconImage];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.contentLabel];
    [self.contentView addSubview:self.cellcopyBut];
    [self.contentView addSubview:self.arrowImage];
    
    
}

-(void)cellFillWithModel:(OtherModel *)model
{
    self.iconImage.image = CoachsBookImageName(model.iconstr);
    self.titleLabel.text = model.title;
    if (model.cellType == 1) {
        self.contentLabel.text = model.content;
        self.cellcopyBut.hidden = NO;
    }
    else
    {
        self.arrowImage.hidden = NO;
    }
    
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
